package org.example.demoarticle.pojo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class ResultByProFile {
    public int code;
    public String msg;
    public DTOdataByFile data;
    @Data
    @AllArgsConstructor
    @NoArgsConstructor
    static class DTOdataByFile {
        private String username;
        private String name;
        private String usertype;
    }
    public static ResultByProFile success(String name,String userName) {
        DTOdataByFile data=new DTOdataByFile();
        data.setName(name);
        data.setUsername(userName);
        if(userName.charAt(0)>='0'&&userName.charAt(0)<='9') {
            data.setUsertype("stu");
        }else {
            data.setUsertype("tch");
        }
        return new ResultByProFile(1,"操作成功",data);
    }
    public static ResultByProFile error (String msg) {
        return new ResultByProFile(0,msg,null);
    }
}
